btc(coin): wire won-block reconstructor into main_btc run-loop (reconstructor slice 7/7 — FINAL) - #844
Merged
Merged
Conversation
…structor slice 7/7 — FINAL) Un-stub tracker.m_on_block_found in src/c2pool/main_btc.cpp: a share that clears the PARENT target now reconstructs the full parent block from live tracker state + the captured template txs and fires the connect-authoritative dual path (P2P relay + submitblock RPC). Until now make_on_block_found (#744) was defined but NEVER assigned, so won shares were silently dropped. Wiring (composes the merged slices 1-6): - TemplateCapture (#837) declared at main scope; create_share_fn seeds it, keyed by the freshly-minted share_hash, with the template non-coinbase tx set ([{"data": <raw-tx-hex>}, ...], template order) so a won share replays the EXACT body it committed to; a capture MISS -> valid coinbase-only block. - make_reconstruct_closure (#839) bound to the live tracker: * share_fields_fn -> share m_min_header + compile-time version + m_merkle_link + optional segwit txid_merkle_link (read chain DIRECTLY: fires on the compute thread already holding m_tracker_mutex exclusively, so it must NOT take read_tracker()). * gentx_bytes_fn -> generate_share_transaction SSOT with a new opt-in out-param exposing the non-witness gentx bytes (the SAME bytes hashed to the committed txid; v36_active=false is byte-identical to the verify-path call, share_check.hpp:1807) -> merkle-consistent. * template_other_txs_fn -> make_template_other_txs_fn(capture.provider()) (#840 decode contract; malformed => fail CLOSED). - make_on_block_found (#744) dual-path: both network sinks are single-thread- confined to the io_context, so each io::post its write onto ioc; the audit reflects arm availability (has_p2p/has_rpc) while the daemon verdict is logged by submit_block_hex (#752) + pending_submits on the io thread. New seam: Node::submit_block_hex_str(hex) forwards the reconstructor hex straight to the submitblock RPC (no bytes round-trip). btc-tree only; no CMakeLists change (all edits to already-compiled files). btc_share_test 106/106 (reconstruct + wiring suites green).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reconstructor slice 7/7 — FINAL
Un-stubs
tracker.m_on_block_foundinsrc/c2pool/main_btc.cpp.make_on_block_found(#744) has been defined but never assigned since the arc began, so a share clearing the parent target was silently dropped. This slice composes the merged building blocks (#822/#835/#837/#838/#839/#840) into the live run-loop.Wiring
create_share_fnseeds it keyed by the freshly-mintedshare_hashwith the template non-coinbase tx set ([{data: <raw-tx-hex>}...], template order). Capture MISS → valid coinbase-only block.share_fields_fn→m_min_header+ compile-time version +m_merkle_link+ optional segwittxid_merkle_link. Readschaindirectly — fires on the compute thread already holdingm_tracker_mutexexclusively (must NOT takeread_tracker()).gentx_bytes_fn→generate_share_transactionSSOT via a new opt-in out-param exposing the non-witness gentx bytes (the SAME bytes hashed to the committed txid;v36_active=falseis byte-identical to the verify-path call at share_check.hpp:1807 → merkle-consistent).template_other_txs_fn→make_template_other_txs_fn(capture.provider())(btc(coin): template_other_txs decode wire — reconstructor slice 6/7 #840; malformed ⇒ fail CLOSED).io::posts its write ontoioc; the audit reflects arm availability (has_p2p/has_rpc) while the daemon verdict is logged bysubmit_block_hex(btc(rpc): always log daemon reject verdict on submitblock #752) +pending_submitson the io thread.New seam
Node::submit_block_hex_str(hex)forwards the reconstructor hex straight to submitblock (no bytes round-trip).Scope / tests
6dc83fdc3(base-off-master rule).btc_share_test106/106 (reconstruct + wiring suites green);c2pool-btclinks clean.Closes the won-block dispatch arc.